﻿<?php 

use yii\widgets\ActiveForm;
use yii\helpers\Html;
use backend\models\TmeUnitinfo;
use backend\models\TmeMerchandiseinfo;




?>


<!-- #alter dialog-message -->

<div id="dialog-alter" class="hide"   >
	
	<?php  
	    /*@var $form yii\widgets\ActiveForm */
		$form = ActiveForm::begin(['enableClientScript'=>true,
						  		   'options'=>[
										'class'=>'form-horizontal',
										'enctype'=>'multipart/form-data',
										'id'=>'altero'
									 ],
								  ]);

	?>
	
	<div  style="font-size:14px;line-height:30px;height:39px">
			会员信息<br/>			
	</div>
	<div class='col-sm-6' >
		<?= $form->field($model,"member",[
										'template'=>'{label}{input}{hint}<span class="help-inline col-xs-12 col-sm-7">{error}</span>	',
										'labelOptions'=>[
											'style'=>[
												'text-align'=>'right',
												'margin-left'=>'10px',
												'float'=>'left',
												'width'=>'50px',
												'height'=>'34px',
												'line-height'=>'34px'
										]],
										
									])->textInput(['readonly'=>'readonly','value'=>$member,'class'=>'col-xs-10 col-sm-5','style'=>['margin-left'=>'10px',]]) ?>
	</div>
	<div class='col-sm-6' >
	<?= $form->field($model,"mail",[
										'template'=>'{label}{input}{hint}<span class="help-inline col-xs-12 col-sm-7">{error}</span>	',
										'labelOptions'=>[
											'style'=>[
												'text-align'=>'right',
												'margin-left'=>'10px',
												'float'=>'left',
												'width'=>'50px',
												'height'=>'34px',
												'line-height'=>'34px'
										]],
										
									])->textInput(['readonly'=>'readonly','value'=>$mail,'class'=>'col-xs-10 col-sm-8','style'=>['margin-left'=>'10px',]]) ?>
	</div>
	<div class='col-sm-12'  >
		<div class="hr hr-12 hr-double"   ></div>
		<div  style="font-size:14px;line-height:30px;height:39px">
			收货信息<br/>			
		</div>
	</div>
	<div class='col-sm-6' >
	<?= $form->field($model,"recMan",[
										'template'=>'{label}{input}{hint}<span class="help-inline col-xs-12 col-sm-7">{error}</span>	',
										'labelOptions'=>[
											'style'=>[
												'text-align'=>'right',
												'margin-left'=>'10px',
												'float'=>'left',
												'width'=>'50px',
												'height'=>'34px',
												'line-height'=>'34px'
										]],
										
									])->textInput(['value'=>$getperson,'class'=>'col-xs-10 col-sm-5','style'=>['margin-left'=>'10px',]]) ?>
	</div>
	<div class='col-sm-6' >
	<?= $form->field($model,"post",[
										'template'=>'{label}{input}{hint}<span class="help-inline col-xs-12 col-sm-7">{error}</span>	',
										'labelOptions'=>[
											'style'=>[
												'text-align'=>'right',
												'margin-left'=>'10px',
												'float'=>'left',
												'width'=>'50px',
												'height'=>'34px',
												'line-height'=>'34px'
										]],
										
									])->textInput(['value'=>$post,'class'=>'col-xs-10 col-sm-5','style'=>['margin-left'=>'10px',]]) ?>
	</div>
	<div class='col-sm-6' style="margin-top:0px" >
		<?= $form->field($model,"tel",[
										'template'=>'{label}{input}{hint}<span class="help-inline col-xs-12 col-sm-7">{error}</span>	',
										'labelOptions'=>[
											'style'=>[
												'text-align'=>'right',
												'float'=>'left',
												'width'=>'60px',
												'height'=>'34px',
												'line-height'=>'34px'
										]],
										
									])->textInput(['value'=>$phone,'class'=>'col-xs-10 col-sm-5','style'=>['margin-left'=>'10px',]]) ?>
	</div>
	<div class='col-sm-6' style="margin-top:0px" >
		<?= $form->field($model,"address",[
										'template'=>'{label}{input}{hint}<span class="help-inline col-xs-12 col-sm-7">{error}</span>	',
										'labelOptions'=>[
											'style'=>[
												'text-align'=>'right',												
												'float'=>'left',
												'width'=>'60px',
												'height'=>'34px',
												'line-height'=>'34px'
										]],
										
									])->textInput(['value'=>$address,'class'=>'col-xs-10 col-sm-8','style'=>['margin-left'=>'10px']]) ?>
	</div>
	
	<div class='col-sm-12'  >
		<div class="hr hr-12 hr-double"  ></div>
		<div  style="font-size:14px;line-height:30px;height:39px">
				配送信息<br/>			
		</div>
	</div>
	<div class='col-sm-6'  >
		<?= $form->field($model,"delivery",[
										'template'=>'{label}	',
										'labelOptions'=>[
											'style'=>[
												'text-align'=>'right',												
												'float'=>'left',
												'width'=>'60px',
												'height'=>'34px',
												'line-height'=>'34px'
										]],
										
									]) ?>
		<div class='col-sm-6' style="margin-top:-50px;margin-left:50px;"  >							
			<select class="chosen-select form-control" name="delivery" id="form-field-select-3" data-placeholder="<?= $delivery ?>" style="margin-top:-30px;margin-top:-24px;height:30px;width:80px"  >		
				<?php 	
					 //输出物流商信息		
					 $temp = "<option value='".$devId."' ></option>";
					foreach ($deliverys as $v ){				
						$temp .= "<option value='".$v['ID']."' >".$v['DeliveryName']."</option>";
					}
					echo $temp; 	
				?>
			</select>
		</div>							
	</div>
	<div class='col-sm-6'  >
	<?= $form->field($model,"state",[
										'template'=>'{label}{input}{hint}<span class="help-inline col-xs-12 col-sm-7">{error}</span>',
										'labelOptions'=>[
											'style'=>[
												'text-align'=>'right',											
												'float'=>'left',
												'width'=>'60px',
												'height'=>'34px',
												'line-height'=>'34px'
										]],
										
									])->textInput(['readonly'=>'readonly','value'=>$states,'class'=>'col-xs-10 col-sm-5','style'=>['margin-left'=>'10px',]]) ?>
	
	</div>
	<?php 
			
	   //根据订单状态判断是否需要显示修改商品信息
	   if($state == 0){	
			
		 echo '<div class=\'col-sm-12\' style="margin-top:-30px;" >
					<div class="hr hr-12 hr-double"  ></div>
					<div  style="font-size:14px;line-height:30px;height:39px">
						商品信息<br/>
					</div>
				</div>';
		 
		 foreach ($orderInfo as $v ){	
			
			$id = $v['ID'];
			$merchanid = $v['MerchandiseID'];  		   //商品编码
			$price = $v['Price'];      				   //商品价格
			$num = $v['Num'];         				   //商品数量
			$totalPrice = $price*$num;      		   //商品总价
			$unitId = $v['UnitID'];    				   //商品单位ID
			$unit = TmeUnitinfo::find()->where(['UnitID'=>$unitId])->asArray()->one();  //查询商品单位表
			$unitName =$unit['Name'];       			//商品单位
			$merchan = TmeMerchandiseinfo::find()->where(['MerchandiseID'=>$merchanid])->asArray()->one();  //查询商品表
			$merchanName = $merchan['MerchandiseName'];	 //商品名			
					
			echo '<div class=\'col-sm-6\' >';
			echo  $form->field($model,"commodity",[
										'template'=>'{label}{input}{hint}<span class="help-inline col-xs-12 col-sm-7">{error}</span>',
										'labelOptions'=>[
											'style'=>[
												'text-align'=>'right',												
												'float'=>'left',
												'width'=>'60px',
												'height'=>'34px',
												'line-height'=>'34px'
										]],
										
									])->textInput(['readonly'=>'readonly','value'=>$merchanName,'class'=>'col-xs-10 col-sm-5','style'=>['margin-left'=>'10px']]) ;
			echo '</div>';
			echo '<div class=\'col-sm-6\' >';
			echo '<div class=\'col-sm-3\' style="margin-left:20px" >';
			echo $form->field($model,"num",[
										'template'=>'{label}{input}{hint}<span class="help-inline col-xs-12 col-sm-7">{error}</span>',
										'labelOptions'=>[
											'style'=>[
												'text-align'=>'right',																																			
												'width'=>'30px',
												'height'=>'34px',
												'line-height'=>'34px'
										]],
										
									])->textInput(['name'=>'OrderForm[num]['.$id.']','value'=>$num,'style'=>['margin-top'=>'-40px','margin-left'=>'40px','width'=>'60px']]) ;
			echo '</div>';
			echo '<div class=\'col-sm-3\' style="margin-left:40px" >';	
			echo $form->field($model,"unit",[
										'template'=>'{label}{input}{hint}<span class="help-inline col-xs-12 col-sm-7">{error}</span>',
										'labelOptions'=>[
											'style'=>[
												'text-align'=>'right',																								
												'float'=>'left',
												'width'=>'30px',
												'height'=>'34px',
												'line-height'=>'34px'
										]],
										
									])->textInput(['readonly'=>'readonly','value'=>$unitName,'style'=>['margin-left'=>'40px','width'=>'35px']]) ;
			echo '</div>';
			echo '</div>';
			echo "<div class='col-sm-6' style='margin-top:-10px' >";
			echo $form->field($model,"price",[
										'template'=>'{label}{input}{hint}<span class="help-inline col-xs-12 col-sm-7">{error}</span>	',
										'labelOptions'=>[
											'style'=>[
												'text-align'=>'right',										
												'float'=>'left',
												'width'=>'60px',
												'height'=>'34px',
												'line-height'=>'34px'
										]],
										
									])->textInput(['name'=>'OrderForm[price]['.$id.']','value'=>$price,'class'=>'col-xs-10 col-sm-5','style'=>['margin-left'=>'10px',]]) ;
			echo '</div>';
			echo "<div class='col-sm-6' style='margin-top:-10px' >";
			echo $form->field($model,"totalPrice",[
										'template'=>'{label}{input}{hint}<span class="help-inline col-xs-12 col-sm-7">{error}</span>	',
										'labelOptions'=>[
											'style'=>[
												'text-align'=>'right',											
												'float'=>'left',
												'width'=>'60px',
												'height'=>'34px',
												'line-height'=>'34px'
										]],
										
									])->textInput(['name'=>'OrderForm[totalPrice]['.$id.']','readonly'=>'readonly','value'=>$totalPrice,'class'=>'col-xs-10 col-sm-5','style'=>['margin-left'=>'10px',]]) ;
			echo '</div>';
			echo "<hr class='col-sm-11' />";
			
		  }	
		}
		
		?>
	
	<?= Html::input("hidden",'action','alter') ?>
	<?= Html::input("hidden",'alterid',$oid) ?>
	<?php ActiveForm::end()  ?>	
</div>

<!-- #alter dialog-message -->

	



	